package client;

import java.io.IOException;

public class ClientSendThread extends Thread{
	private Client client;
	
	public ClientSendThread(Client client)
	{
		this.client=client;
	}
	
	public String sendMessage(String sndMessage)
	{     
		String ans=null;
		 if(sndMessage!=null)
		 {			
			 client.out.println(sndMessage);
			 System.out.println("客户端说： "+sndMessage);
			 client.out.flush();	
			 try {
				 ans=client.in.readLine();
				 System.out.println("服务端回应:" + ans);
			     } 
			 catch (IOException e) {
				e.printStackTrace();
			  }
		}
		 return ans;
		
	}
	
    public void run()
    {
    	while (true)
		{ // 等待信息输入
			try {
				sleep(3);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
    }
    
}
